package com.black.quick.service;

import com.black.quick.dao.GoodsDao;
import com.black.quick.domain.QuickGoods;
import org.springframework.beans.factory.annotation.Autowired;
import com.black.quick.vo.*;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author shy_black
 * @date 2019/7/25 15:12
 * @Description:
 */
@Service
public class GoodsService {

    @Autowired
    GoodsDao goodsDao;


    public List<GoodsVo> listGoodsVo() {
        return goodsDao.listGoodsVo();
    }

    public GoodsVo getGoodsVoByGoodsId(long goodsId) {
        return goodsDao.getGoodsVoByGoodsId(goodsId);
    }
    public void reduceStock(GoodsVo goods) {
        QuickGoods g = new QuickGoods();
        g.setGoodsId(goods.getId());
        goodsDao.reduceStock(g);
    }
}
